package main;

import processing.core.PApplet;
import processing.core.PImage;


public class Pointillism extends PApplet{

    PImage pImage;
    int smallPints, largePints;


    @Override
    public void settings() {
        size(640, 360);
    }

    @Override
    public void setup() {
        smallPints = 4;
        largePints = 40;
        pImage = loadImage("C:\\Users\\Hyper\\Pictures\\land.jpg");
        //pImage = createImage(240,240,ARGB);
        imageMode(CENTER);
        noStroke();
        background(255);
    }

    @Override
    public void draw() {
        float pointillize = map(mouseX, 0, width, smallPints, largePints);

        int x = (int) random(pImage.width);
        int y = (int) random(pImage.width);
        // org uses color pix = pImage.get(x,y) and i don't understand.
        int pix = pImage.get(x, y);
        fill(pix, 128);
        ellipse(x, y, pointillize, pointillize);

    }
}
